package app

import (
	"gitee.com/xxhsjp/x-core/conf"
	"gitee.com/xxhsjp/x-core/model"
	"github.com/pkg/errors"
	"github.com/sirupsen/logrus"
)

var App = &model.App{}

func init() {
	viper := conf.Wrapper
	viper.Unmarshal(App)
	s, err := viper.GetDecryptedString(App.Secret, true)
	if err != nil {
		logrus.Errorf("%+v", errors.WithStack(err))
		panic(err)
	}
	App.Secret = s
	logrus.Debugf("App config: %+v", App)
}
